<?php
$this->pageHeader = t('PAGE_HEADER_EDIT', 'menu');
$this->pageTitle = t('PAGE_TITLE', 'menu');
$toolbar = new LGToolbar();
$toolbar->ButtonSave(t('BTN_SAVE'), '#menu-form', ActionType::SAVE);
$toolbar->ButtonSave(t('BTN_SAVE_AND_CLOSE', 'article'), '#menu-form', ActionType::SAVE_CLOSE);
$toolbar->ButtonSave(t('BTN_SAVE_AND_NEW', 'article'), '#menu-form', ActionType::SAVE_NEW);
$toolbar->Cancel('btnCancel',t('BTN_CANCEL'));
$this->pageToolbar = $toolbar->mergeToolbar();
$this->breadcrumbs = array(t('MENU_MANAGEMENT'),  t('LBL_MENU_TYPE', 'menuType') => url('menutype'), 'Menu Item' => array('index'));
?>

<?php
if ($model->extension != NULL) {
if ($model->extension->view == LGConstant::EXTENSION_VIEW_CATEGORY_BLOG) {
    $arr = CJSON::decode($model->param);
    $model->categoryId = $arr['id'];
} else if ($model->extension->view == LGConstant::EXTENSION_VIEW_SINGLE_ARTICLE) {
    $arr = CJSON::decode($model->param);
    if ($arr != NULL) {
    $article = Article::model()->find('id=?', array($arr['id']));
    if ($article) {
        $model->article = $article->title;
    }
    }
} else if ($model->extension->view == LGConstant::EXTENSION_VIEW_EXTERNAL_LINK) {
    $model->external_link = $model->link;
} else if ($model->extension->view == LGConstant::EXTENSION_VIEW_GALLERY_ITEM) {
     $arr = CJSON::decode($model->param);
     $model->album_id = $arr['id'];
}
}
echo $this->renderPartial('_form', array('model' => $model), false, true);

?>